<script>
import * as types from './store/mutation-types/userInfo';

export default {
  created () {
      var _this=this;
      //获取当前用户的token值 用于判断用户是否登陆过这个小程序
      var userToken=wx.getStorageSync('userToken');
      wx.login({
          success: res => {
              //发送res.code到后台换取openId , sessionKey , unionId
              var code= res.code;
              _this.$store.dispatch("setCode",code);

              wx.getUserInfo({
                  success(res){
                      _this.$store.dispatch("setTheUserInfo", res.userInfo);
                  }
              });
          }
      })
  }
}
</script>

<style>
.container {

}
</style>
